#include<stdio.h>
int main(){
	int year = 0;
	int ishave = 0;
	
	scanf("%d",&year);
	if(year > 2000 && year <= 2100){
		for(int i=2001;i<=year;i++){
			//能被4整除但不能被100整除
			if(i % 4 == 0 && i % 100 != 0){
				printf("%d\n",i);
				ishave = 1;
			//能被400整除
			}else if(i % 400 ==0){
				printf("%d\n",i);
				ishave = 1;
			}
		}
	}else{
		printf("Invalid year!");
		ishave = 1;
	}
	//不存在闰年
	if(ishave == 0){
		printf("None");
	}
	return 0;
}
